<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button>按钮</button>
    <script>
        const btn = document.querySelector("button");
        // 赋值点击事件
        btn.onclick = () => {
            console.log("按钮被点击了")
        };
        btn.addEventListener("click", function () {
            console.log("function按钮被点击了", this)
        });
        btn.addEventListener("click", (e) => {
            console.log("箭头函数被点击了", e.currentTarget)
        })
    </script>
</body>

</html>